 {layout name="common/layout" /}
 <script type="text/javascript" src="__MERCHANT_STATIC__/PrintArea/jquery.PrintArea.js"></script>
 <script type="text/javascript" src="__MERCHANT_STATIC__/PrintArea/LodopFuncs.js"></script>
 <style>
	.tabBar>span {
		position: relative;
	}

	.tabBar>span>a {
		display: inline-block;
		height: 100%;
		width: 100%;
		text-align: center;
		line-height: 40px;
	}
	.goods_tab td{
		border: 1px solid black;
	}
</style>
<link rel="stylesheet" type="text/css" href="__MERCHANT_STATIC__/style/css/order/index.css" />
<div class="Hui-article-box" style="margin-top: 37px;">
	<div class="Hui-article" style="top:0px;margin-top:0px !important">

		<div class="cl" style="margin-bottom: 40px;">
			<div class="article-order">
				<h3 class="order_main_title">图书订单管理</h3>
				<div class="borrowOrder_form">
					<form action="{:url('book/borrowOrder')}" method="get" style="border:0;margin: 0 auto;">
						<?php $keyword = input('param.keyword'); ?>
						<span >关键字</span><input type="text" value="{$keyword}" class="input-text" style="width:250px" placeholder="输入订单关键字" id="" name="keyword">
						<input type="hidden" name="type" value="{$data['type']}"/>
						<button type="submit" class="btn btn-success radius" id="btn_sub" name=""> 搜索</button>
						{if condition="$type eq '2'"}
						<input type="button" class="btn btn-success radius" id="print_deliver" style="width: 140px;height: 35px;" value="生成近五天发货单"/>
						<input type="button" class="btn btn-success radius" id="export_deliver" style="width: 140px;height: 35px;" value="导出近五天快递单"/>
						<input type="button" class="btn btn-success radius" id="print_booklist" style="width: 140px;height: 35px;" value="打印近五天书单"/>
						<!--<input type="button" class="btn btn-success radius" id="show_deliver_mailno" style="width: 200px;height: 35px;" value="近五天快递一键发货和导出"/>-->
						{/if}
						{in name="$type" value="1,3,4"}
						<input type="text" value="{$keyword_end}" class="input-text" style="width:250px" placeholder="归还快递单号" id="keyword_end" name="keyword_end">
						<button type="submit" class="btn btn-success radius" id="btn_end" name="" style="width: 100px;height: 35px;"> 结算</button>
						{/in}
					</form>
					{if condition="$type eq '2'"}
					<form action="{:url('book/pbatchImportHandleDeliver')}" method="post" enctype="multipart/form-data" style="border:0;margin:0 90px 0 0;position: relative;">
						<label>发货操作：</label>
						<input type="file" name="SFOrder" style="margin: 10px 0 10px 0;width:180px;"/>
						<input class="btn btn-success radius" style="width: 140px;" type="submit" value="一键导入发货"/>
					</form>
					{/if}
				</div>
				<div id="tab_demo" style="padding-left:0">
					<div class="tabBar clearfix order_main_List">
						<span class="order_main_single"><a href="{:url('book/borrowOrder')}?type=1<?php echo empty($keyword)? '' : '&keyword='.$keyword;?>">全部订单</a></span>
						<span class="order_main_single"><a href="{:url('book/borrowOrder')}?type=2<?php echo empty($keyword)? '' : '&keyword='.$keyword;?>">待发货</a></span>
						<span class="order_main_single"><a href="{:url('book/borrowOrder')}?type=3<?php echo empty($keyword)? '' : '&keyword='.$keyword;?>">待归还</a></span>
						<span class="order_main_single"><a href="{:url('book/borrowOrder')}?type=4<?php echo empty($keyword)? '' : '&keyword='.$keyword;?>">待结算</a></span>
						<span class="order_main_single"><a href="{:url('book/borrowOrder')}?type=5<?php echo empty($keyword)? '' : '&keyword='.$keyword;?>">成功订单</a></span>
						<span class="order_main_single"><a href="{:url('book/borrowOrder')}?type=6<?php echo empty($keyword)? '' : '&keyword='.$keyword;?>">逾期订单</a></span>
						<span class="order_main_single"><a href="{:url('book/borrowOrder')}?type=7<?php echo empty($keyword)? '' : '&keyword='.$keyword;?>">取消订单</a></span>
					</div>
						<!--数据区-->
						<table class="order_table table table-border table-bg  table-bordered">
							<tr class="text-c text-cs">
								<th style="width: 155px;">用户手机</th>
								<th style="width: 155px;">订单号</th>
								<th style="width: 250px;">会员卡</th>
								<th>收货人手机</th>
								<th>收货人</th>
								<th>图书数量</th>
								{if condition="$type eq '2'"}
								<th>收货地址</th>
								{/if}
								<th>备注</th>
								<th>起租时间</th>
                                                                {if condition="$type neq '7'"}
								<th>归还时间</th>
                                                                {else/}
                                                                <th>取消时间</th>
                                                                {/if}
								{if condition="$type eq '5'"}
								<th>结算时间</th>
								{else/}
								{if condition="$type eq '3'"}
								<th>发货时间</th>
								{else/}
								<th>创建时间</th>
								{/if}
								{/if}
								<th>订单状态</th>
							</tr>
							{volist name="$data.order_list" id="order"}
							<tr {if condition="$type <= 4 and $order.rent_end_time < date('Y-m-d',strtotime('+5 day'))"} style="height: 40px; background-color:#e6e6e6c7;" {/else} style="height: 40px;" {/if} class="text-c">
								<td>{$order.user_phone}</td>
								<td >
									<a href="{:url('book/borrowDetail')}?order_id={$order['id']}">
										{$order.order_sn}
									</a>
									<?php if($order['is_renew'] == 1){ ?>
									(存在续租)
									<?php } ?>
								</td>
								<td style="width: 250px;">
									{if condition="$order.user_card_id neq '0'"}
										{if condition="$order.status neq '1'"}
											{switch name="$order.rank"}
											{case value="1"}小状元计划{/case}
											{case value="2"}小博士计划{/case}
											{case value="3"}免费体验计划{/case}
											{/switch}
											-
											{switch name="$order.type"}
											{case value="1"}月卡{/case}
											{case value="2"}季卡{/case}
											{case value="3"}半年卡{/case}
											{case value="4"}年卡{/case}
											{/switch}
											({$order.card_no})
										{else/}
											绘本直购
										{/if}
									{else/}
										绘本直购
									{/if}
								</td>
								<td><?php echo (!empty($order['address_snapshot'])) ? json_decode($order['address_snapshot'],true)['mobile'] : $order['user_phone'];?></td>
								<td><?php echo (!empty($order['address_snapshot'])) ? json_decode($order['address_snapshot'],true)['address_name'] : $order['address_name'];?></td>
								<td>{$order.book_num}</td>
								{if condition="$type eq '2'"}
								<td>
									<?php
										$address_info = json_decode($order['address_snapshot'],true);
										echo $address_info['province'].$address_info['city'].$address_info['district'].$address_info['address'];
									?>
								</td>
								{/if}
								<td><textarea class="remark_field" onkeyup="savedata(this)" data-id="{$order['id']}" readonly style="resize: both;border: 0px;border-bottom:1px solid;height:18px;" contenteditable="true">{$order.remark}</textarea></td>
								<td>{$order.rent_start_time}</td>
                                                                {if condition="$type neq '7'"}
								<td>{$order.rent_end_time}</td>
                                                                {else/}
                                                                <td>{$order.cancel_time}</td>
                                                                {/if}
								{if condition="$type eq '5'"}
								<td>{$order.settlement_time}</td>
								{else/}
								{if condition="$type eq '3'"}
								<td>{$order.shipping_time}</td>
								{else/}
								<td>{$order.create_time}</td>
								{/if}
								{/if}
								<td>
									{switch name="$order.status"}
										{case value="-1"}成功订单{/case}
										{case value="1"}待支付{/case}
										{case value="2"}
											<a href="{:url('book/borrowDeliver')}?order_id={$order['id']}"><span class="index_orderType">发货</span></a>
											<a href="javascript:void(0);"><span class="index_orderType print_order" data-id="{$order['id']}" style="margin-left: 5px;">打印书单</span></a>
										{/case}
										{case value="3"}待收货{/case}
										{case value="4"}待归还{/case}
										{case value="5"}<a href="{:url('book/borrowJiesuan')}?order_id={$order['id']}"><span class="index_orderType">结算</span></a>{/case}
										{case value="7"}待评价{/case}
										{case value="8"}成功订单{/case}
										{case value="11"}退款中{/case}
										{case value="12"}退款成功{/case}
										{default /}无效订单
                                {/switch}
                            </td>
                        </tr>
                        {/volist}
                    </table>
                    <!--数据区-->
					{$data.page}
				</div>
				<!--打印单区-->
				<div id="modal-demo" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
					<div class="modal-dialog" style="margin:30px 700px;">
						<div class="modal-content radius" style="width: 500px;">
							<div class="modal-header">
								<h3 class="modal-title" style="text-align: center;">发货单</h3>
								<a class="close" data-dismiss="modal" aria-hidden="true" href="javascript:void();">×</a>
							</div>
							<div class="modal-body">
								<img class="loading" src="__MERCHANT_STATIC__/style/images/loading.gif" style="position: absolute;float: left;margin: 250px 200px;display:none;"/>
								<div id="print_area" style="position: relative;width: 100%;">
								<table class="goods_tab" style="border: 1px solid black;text-align: left;width: 100%;">
									<thead style="position: relative;font-size: 14px;width: 100%;word-wrap: break-word;">
									<td style="border: 1px solid black;">出版社</td>
									<td style="border: 1px solid black;">绘本</td>
									<td style="border: 1px solid black;">收货人</td>
									<td style="border: 1px solid black;">起租日期</td>
									<td style="border: 1px solid black;">手机</td>
									</thead>
									<tbody class="dorder_list" style="position: relative;font-size: 14px;width: 100%;word-wrap: break-word;">

									</tbody>
								</table>
								</div>
							</div>
							<div class="modal-footer">
								<span class="page_bat" style="margin-right: 20px;"></span>
								<span class="btn deliver_export_btn">导出</span>
								<span class="btn print_btn">打印</span>
							</div>
						</div>
					</div>
				</div>
				<!--打印单区-->
				<!--快递单展示区-->
				<div id="mailno-demo" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
					<div class="modal-dialog" style="margin:30px 400px;">
						<div class="modal-content radius" style="width: 1200px;">
							<div class="modal-header">
								<h3 class="modal-title" style="text-align: center;">发货快递单</h3>
								<a class="close" data-dismiss="modal" aria-hidden="true" href="javascript:void();">×</a>
							</div>
							<div class="modal-body">
								<img class="loading" src="__MERCHANT_STATIC__/style/images/loading.gif" style="position: absolute;float: left;margin: 250px 550px;display:none;"/>
								<div id="mail_area">
									<table class="goods_tab" style="border: 1px solid black;text-align: left;width: 100%;">
										<thead style="position: relative;font-size: 12px;width: 100%;word-wrap: break-word;">
										<td style="border: 1px solid black;">订单号</td>
										<td style="border: 1px solid black;">收货人</td>
										<td style="border: 1px solid black;">手机</td>
										<td style="border: 1px solid black;">顺丰运单号</td>
										<td style="border: 1px solid black;">错误信息</td>
										</thead>
										<tbody class="morder_list" style="position: relative;font-size: 10px;width: 100%;word-wrap: break-word;font-size: 8px;">

										</tbody>
									</table>
								</div>
							</div>
							<div class="modal-footer">
								<span class="page_bat" style="margin-right: 20px;"></span>
							</div>
						</div>
					</div>
				</div>
				<!--快递单展示区-->
				<!--打印小票区-->
				<div id="ticket-demo" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
					<div class="modal-dialog" style="margin:30px 900px;">
						<div class="modal-content radius" style="width: 350px;">
							<div class="modal-header">
								<h3 class="modal-title" style="text-align: center;">打印小票</h3>
								<a class="close" data-dismiss="modal" aria-hidden="true" href="javascript:void();">×</a>
							</div>
							<div class="modal-body" style="position: relative;">
								<img class="ticket_loading" src="__MERCHANT_STATIC__/style/images/loading.gif" style="position: absolute;float: left;margin: 250px 550px;display:none;"/>
								<div id="ticket_area" style="width:100%;font-size: 14px;line-height: 18px;">
									<div id="ticket_title" style="text-align: center;width:100%;padding: 25px 0;line-height: 20px;font-size: 20px;">
										<span>博鸟绘本-绘本清单</span>
									</div>
									<div id="ticket_head" style="text-align: left;position: relative;width:100%;padding-bottom: 5px;line-height: 15px;border-bottom: 1px black solid;">
										<span class="order_sn" style="line-height: 15px;font-size:12px;position: relative;width:100%;margin-bottom: 10px;bottom:6px;">订单号：</span><br/>
										<span class="order_date" style="line-height: 15px;font-size:12px;position: relative;width:100%;bottom:3px;">租用日期：2018-01-01至2018-04-30</span><br/>
										<span class="order_person" style="line-height: 15px;font-size:12px;position: relative;width:100%;">收货人：某某某&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tel:13485958392</span><br/>
									</div>
									<div id="ticket_body" style="position: relative;width:100%;line-height: 10px;">
									<table class="books_tab" style="border:0px #fff solid;font-size: 10px;text-align: left;position: relative;width:100%;">

										<!--<div style="position: relative;font-size: 12px;width: 100%;word-wrap: break-word;display: inline-block;">-->
												<!--<div style="position:relative;width: 33%;display: inline-table;">序</div>-->
												<!--<div style="position:relative;width: 33%;display: inline-table;">绘本</div>-->
												<!--<div style="position:relative;width: 30%;display: inline-table;">出版社</div>-->
										<!--</div>-->
										<!--<div class="dorder_list" style="position: relative;font-size: 12px;width: 100%;word-wrap: break-word;">-->

										<!--</div>-->

										<thead style="position: relative;font-size: 12px;width: 100%;word-wrap: break-word;">
										<tr style="position: relative;width: 100%;line-height: 15px;font-size: 12px;">
										<td style="width: 33.3%;">序</td>
										<td style="width: 33.3%;">出版社</td>
										<td style="width: 33.3%;">绘本</td>
										</tr>
										</thead>
										<tbody class="dorder_list" style="line-height: 15px;font-size: 12px;position: relative;width: 100%;word-wrap: break-word;">

										</tbody>
									</table>
									</div>
									<div id="ticket_footer" style="position: relative;width:100%;text-align: left;padding-top: 5px;border-top: 1px black solid;">
										<span style="line-height: 15px;font-size:12px;position: relative;width:100%;word-wrap: break-word;">公司名称: 博鸟绘本</span><br/>
										<span style="line-height: 15px;font-size:12px;position: relative;width:100%;word-wrap: break-word;top:3px;">联系电话: 0571-86113050</span><br/>
										<span style="line-height: 15px;font-size:12px;position: relative;width:100%;word-wrap: break-word;top:6px;">归还地址: 浙江省杭州市余杭区仓前街道未来研创园A幢307室</span><br/>
										<span style="line-height: 15px;font-size:12px;position: relative;width:100%;word-wrap: break-word;top:9px;">归还电话: 18301119746</span><br/>
										<span style="margin:5px 37%;width: 20%;" ><img style="width: 85px;height: 85px;margin-top: 10px;" src="__MERCHANT_STATIC__/style/images/ibaoniao.png"></span><br/>
										<span style="line-height: 15px;font-size:12px;position: relative;width:70%;word-wrap: break-word;margin:0 25%;">打开微信扫一扫，关注【博鸟绘本】公众号</span><br/>
										<span style="line-height: 15px;font-size:12px;position: relative;width:40%;word-wrap: break-word;margin:0 40%;">海量绘本等您借阅</span>
										<span style="line-height: 15px;font-size:12px;position: relative;width:40%;word-wrap: break-word;margin:0 40%;" id="page_num"></span>
									</div>
								</div>
							</div>
							<div class="modal-footer">
								<span class="page_bat" style="margin-right: 20px;"></span>
								<span class="btn ticket_print_btn">打印</span>
							</div>
						</div>
					</div>
				</div>
				<!--打印小票区-->
			</div>
		</div>

	</div>
</div>

<script language="javascript" type="text/javascript">
	function update_time(id){
        $.ajax({
            url: "{:url('book/getBorrowOrderCount')}",
            type: "GET",
            data: {
            },
            async: true,
            dataType: "json",
            success: function (response) {

            },
            error: function (error) {
            }
        });
	}

	$(function () {
		var type = "{$data.type}";
		var num = 1;
		if (type){
            var num = parseInt(type);
        }
        num=num-1;
        //console.log(num);
		$.Huitab("#tab_demo .tabBar span", "#tab_demo .tabCon", "current", "click", num)
	});
	$(document).ready(function(){
		$("#keyword_end").focus();
	});


	/* 获取图书订单数量 */
	$(document).ready(function(){
		$.ajax({
			url: "{:url('api/index/getBorrowOrderCount')}",
			type: "GET",
			data: {
			},
			async: true,
			dataType: "json",
			success: function (response) {
				var orderNumber=response.data;
				$(".order_main_single>a").each(function(index,element) {
					/* 当前图书订单顺序 */
					/* 1，2，3，4，5，6*/
					index+=1;
					$(this).text($(this).text()+'('+orderNumber[index]+")");
				});
			},
			error: function (error) {
			}
		});
	});

    /**
     * 打印发货单
     */
    $("#print_deliver").click(function () {
        $("#modal-demo").modal("show");
        $(".loading").show();
        $.post("{:url('book/getDeliverOrderBookList')}",{},function(data) {
            if(data.status == 1){
                var dorder = $('.dorder_list');
                dorder.empty();
				for(var i=0;i<data.data.length;i++){
                    dorder.append("<tr style='padding-bottom: 5px;'><td style='padding-left:3px;border: 1px solid black;'>"+data.data[i].publisher+"</td><td style='border: 1px solid black;'>"+data.data[i].title+"</td><td style='border: 1px solid black;'>"+data.data[i].user_name+"</td><td style='border: 1px solid black;padding-left:3px;'>"+data.data[i].rent_start_time+"</td><td style='border: 1px solid black;'>"+data.data[i].user_phone+"</td></tr>");
				}
                $(".loading").hide();
            }else{
                layer.msg(data.msg);
                $(".loading").hide();
                $("#modal-demo").modal("hide");
			}
		},'json');
    });
    
    $(".deliver_export_btn").click(function () {
        location.href="pbatchExportDeliverOrder";
    });

    $("#show_deliver_mailno").click(function () {
        $("#mailno-demo").modal("show");
        $(".loading").show();
        $.post("{:url('book/pbatchGetSFMailno')}",{},function(data) {
            if(data.status == 1){
                var dorder = $('.morder_list');
                dorder.empty();
                for(var i=0;i<data.data.deliver_order.length;i++){
                    dorder.append("<tr style='padding-bottom: 5px;'><td style='padding-left:3px;border: 1px solid black;'>"+data.data.deliver_order[i].order_sn+"</td><td style='border: 1px solid black;'>"+data.data.deliver_order[i].user_name+"</td><td style='border: 1px solid black;padding-left:3px;'>"+data.data.deliver_order[i].mobile+"</td><td style='border: 1px solid black;'>"+data.data.deliver_order[i].mail_no+"</td><td style='border: 1px solid black;'>"+data.data.deliver_order[i].err_msg+"</td></tr>");
                }
                $(".loading").hide();
                location.href="exportOrderSFMailInfo?data="+JSON.stringify(data.data.export_data);
            }else{
                layer.msg(data.msg);
                $(".loading").hide();
                $("#mailno-demo").modal("hide");
            }
        },'json');
    });

    $("#print_booklist").click(function () {
        $.post("{:url('book/pbatchDeliverOrderTicket')}",{},function(data) {
            if(data.status == 1){
                for(var j=0;j<data.data.length;j++) {
                    $(".order_sn").empty();
                    $(".order_sn").append("订单号: " + data.data[j].order_info.order_sn);
                    $(".order_date").empty();
                    $(".order_date").append("租用日期: " + data.data[j].order_info.rent_start_time + "&nbsp;至&nbsp;" + data.data[j].order_info.rent_end_time);
                    $(".order_person").empty();
                    $(".order_person").append("收货人: " + data.data[j].order_info.name + "&nbsp;&nbsp;&nbsp;&nbsp;手机号: " + data.data[j].order_info.mobile);
                    var dorder = $('.dorder_list');
                    dorder.empty();
                    for (var i = 0; i < data.data[j].book_list.length; i++) {
                        dorder.append("<tr style='padding-bottom: 5px;line-height: 14px;font-size: 12px;'><td colspan='3' style='word-wrap: break-word;'>" + (i + 1) + ".&nbsp;" + data.data[j].book_list[i].publisher + "&nbsp;-- 《" + data.data[j].book_list[i].title + "》</td></tr>");
                    }
                    $('#page_num').html('-- 第' + ( j + 1 ) +'页 --');
                    prn_print();
                }
            }else{
                layer.msg(data.msg);
            }
        },'json');
    });

    $("#export_deliver").click(function () {
        location.href="pbatchExportSFOrder";
    });

    $(".print_order").click(function () {
        var order = $(this).attr("data-id");
        $("#ticket-demo").modal("show");
        $(".ticket_loading").show();
        $.post("{:url('book/getDeliverOrderTicket')}",{order:order},function(data) {
            if(data.status == 1){
                $(".order_sn").empty();
                $(".order_sn").append("订单号: "+data.data.order_info.order_sn);
                $(".order_date").empty();
                $(".order_date").append("租用日期: "+data.data.order_info.rent_start_time+"&nbsp;至&nbsp;"+data.data.order_info.rent_end_time);
                $(".order_person").empty();
                $(".order_person").append("收货人: "+data.data.order_info.name+"&nbsp;&nbsp;&nbsp;&nbsp;手机号: "+data.data.order_info.mobile);
                var dorder = $('.dorder_list');
                dorder.empty();
                for(var i=0;i<data.data.book_list.length;i++){
                    //dorder.append("<span style='position: relative;width:100%;word-wrap: break-word;'>"+(i+1)+".&nbsp;《"+data.data.book_list[i].title+"》-- "+data.data.book_list[i].publisher+"</span><br/>");
                    dorder.append("<tr style='padding-bottom: 5px;line-height: 14px;font-size: 12px;'><td colspan='3' style='word-wrap: break-word;'>"+(i+1)+".&nbsp;"+data.data.book_list[i].publisher+"&nbsp;-- 《"+data.data.book_list[i].title+"》</td></tr>");
                    //dorder.append("<tr style='padding-bottom: 5px;'><td style='padding-left:3px;' colspan='3'>-- "+data.data.book_list[i].publisher+"</td></tr>");
                }
                //prn_print();
                $(".ticket_loading").hide();
                $('#page_num').html('第 1 页');
            }else{
                layer.msg(data.msg);
                $(".ticket_loading").hide();
                $("#ticket-demo").modal("hide");
            }
        },'json');
	});

    $(".print_btn").click(function () {
        $("#print_area").printArea();
    });

    $(".ticket_print_btn").click(function () {
        prn_print();
        //$("#ticket_area").printArea();
    });
    var LODOP;//声明为全局变量
    function prn_print(){
        CreateOneFormPage();
        LODOP.PRINT();
        //LODOP.PREVIEW();
    }

    function CreateOneFormPage(){
        LODOP=getLodop();
        LODOP.PRINT_INIT();
        //LODOP.SET_PRINT_STYLEA(0,"FontName","宋体");
        LODOP.SET_PRINT_STYLEA(0,"FontSize",10);//打印区域的字体大小
        LODOP.SET_PRINT_PAGESIZE(3,'148mm','210mm');//打印区域的整体尺寸

        //LODOP.ADD_PRINT_HTM(15,"3%","94%","10mm",document.getElementById("ticket_title").innerHTML);
        LODOP.ADD_PRINT_HTM(15,"3%","94%","10mm",document.getElementById("ticket_area").innerHTML);
        LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
        LODOP.SET_PRINT_STYLE("ItemType",0);
//        LODOP.ADD_PRINT_HTM("12mm","3%","94%","40mm",document.getElementById("ticket_head").innerHTML);
//        LODOP.SET_PRINT_STYLEA(0,"Alignment",2);
//        LODOP.SET_PRINT_STYLE("ItemType",0);
//        LODOP.ADD_PRINT_LINE(112,3,112,383,0,1);
//        LODOP.ADD_PRINT_HTML(115,"3%","94%",420,document.getElementById("ticket_body").innerHTML);
//        LODOP.SET_PRINT_STYLEA(0,"Bold",1);
//        LODOP.SET_PRINT_STYLE("ItemType",0);
//        LODOP.NEWPAGE();
//        LODOP.ADD_PRINT_LINE(0,3,0,383,0,1);
//        LODOP.ADD_PRINT_HTM(3,"3%","94%","40mm",document.getElementById("ticket_footer").innerHTML);
        //LODOP.SET_PRINT_STYLE("ItemType",0);
        //LODOP.SET_PRINT_STYLE("ItemType",4);
        //LODOP.SET_PRINT_STYLE("HOrient",2);
        //LODOP.SET_PRINT_MODE("PRINT_PAGE_PERCENT","Width:100%;");
        //LODOP.SET_PREVIEW_WINDOW(0,0,0,760,540,"");
        //LODOP.SET_PRINT_MODE("PRINT_PAGE_PERCENT","Auto-Width");//整宽不变形
        //LODOP.SET_SHOW_MODE("PREVIEW_IN_BROWSE",true);
        //LODOP.SET_SHOW_MODE("SETUP_IN_BROWSE",true);
        //LODOP.SET_SHOW_MODE("DESIGN_IN_BROWSE",true);
    }


    /**
     * 备注相关
     */
	$('.remark_field').dblclick(function(){
	    $(this).removeAttr('readonly');
        $(this).css('border','1px solid');
        $(this).focus();
	});

	function savedata(obj){
        if (window.event)//如果window.event对象存在，就以此事件对象为准
            e = window.event;
        var code = e.charCode || e.keyCode;
        if(code == 13){
            obj.style.border = '0px';
            obj.style.borderBottom = '1px solid';
            obj.setAttribute("readonly",true);
            obj.value = $.trim(obj.value);
            //if(obj.value !== ''){
                var order = obj.dataset.id;
                $.post("{:url('book/setOrderRemark')}",{remark:obj.value,order:order},function (data) {
                    if(data.status == 0){
                        layer.msg(data.msg);
                    }
                });
			//}
		}
	}

</script>
